package com.net.xpay.backend;

import com.net.xpay.backend.job.SafePayNotifyJob;
import com.net.xpay.backend.job.SafePayNotifyMainJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import javax.sql.DataSource;

/**
 * 后台任务的入口 方便注入service
 * @Description: <br>
 * @Project: hades <br>
 * @ Created in 2018/8/31 13:35 <br>
 *
 */
@Service
public class JobEntry {

    @Autowired
    @Qualifier("commonDataSource")
    private DataSource commonDataSource;

    @Autowired
    @Qualifier("shardDataSource")
    private DataSource shardDataSource;

    @Autowired
    private SafePayNotifyMainJob safePayNotifyMainJob;

    @Autowired
    private SafePayNotifyJob safePayNotifyJob;

    public void start() {
        new Thread(safePayNotifyMainJob).start();
        new Thread(safePayNotifyJob).start();
    }
}
